/*
 * usart.h
 *
 *  Created on: 07.02.2012
 *      Author: Roma Jam
 */

#ifndef USART_H_
#define USART_H_

#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"

#define USART1_CLK          RCC_APB2Periph_USART1
#define USART1_TX_PIN       GPIO_Pin_9
#define USART1_RX_PIN       GPIO_Pin_10
#define USART1_GPIO         GPIOA
#define USART1_GPIO_CLK     RCC_APB2Periph_GPIOA

#define COM_Port_Connected()GPIO_ReadInputDataBit(USART1_GPIO, USART1_RX_PIN)

class usart_t {
private:
public:
    void Init(void);
    void Terminal_Task(void);
    void Terminal_Angle_Task(void);
    void LabServer_Task(void);
    uint16_t ClientData_Recieve(void);
    bool Reset(void);
    bool Quit(void);
    void Print (uint8_t AByte);
    void Send (uint16_t AByte);
    void Print_Char (uint8_t DChar);
    void Print_String (const char *R);
    void Print_Uint (uint16_t ANumber);
};
extern usart_t USART;

#endif /* USART_H_ */
